import os
import py.For_ as For_      # 导入 For循环功能
import py.While_ as While_  # 导入 While循环功能
import py.PathSize          # 导入递归统计目录大小功能

"""
CSDN第一周作业
"""


def main():
    print("\n"*80)
    print("开发者你好~!欢迎您使用本示例!")
    print("\n{0:<50}\n{1:<50}\n{2:<50}\n{3:<50}\n".format(
        "1.查看使用循环语句来实现输出99乘法表效果",
        "2.使用存款管理系统",
        "3.统计目录大小",
        "0.退出"
    ))
    keys = input("请输入一个数字来选择:")
    if keys == "1":
        multiplication_table()
    elif keys == "2":
        bank()
    elif keys == "3":
        pathDir()
    elif keys == "0":
        print("\n"*60)
        print("感谢你使用本示例~!再见...")
        exit()
    else:
        print("a")


def multiplication_table():
    while True:
        print("\n"*60)
        print("你正在查看使用For和While循环输出实现99乘法表效果的示例!")
        print("="*90)
        print("\n{0:<20}{1:<20}{2:<20}{3:<20}\n{4:<20}{5:<20}{6:<20}{7:<20}\n{8:<20}\n".format(
            "1.For循环效果一", "2.For循环效果二",
            "3.For循环效果二", "4.For循环效果二",
            "5.For循环效果二", "6.For循环效果二",
            "7.For循环效果二", "8.For循环效果二",
            "0.返回主菜单"
        ))
        keys = input("请输入一个数字来选择:")
        if keys == "1":
            For_.for01()
        elif keys == "2":
            For_.for02()
        elif keys == "3":
            For_.for03()
        elif keys == "4":
            For_.for04()
        elif keys == "5":
            While_.while01()
        elif keys == "6":
            While_.while02()
        elif keys == "7":
            While_.while03()
        elif keys == "8":
            While_.while04()
        elif keys == "0":
            main()


def bank():
    import py.Bank_ as Bank_    # 导入 自动存取款功能
    Bank_.page01()


def pathDir():
    while True:
        print("\n"*60)
        print("你正在查看使用递归统计目录大小的示例!")
        print("="*90)
        print("\n{0:<20}\n{1:<20}\n".format(
            "输入一个路径来返回磁盘占用情况",
            "0.返回主菜单"
        ))

        keys = input("请输入一个路径来返回磁盘占用情况:")
        if keys == "0":
            main()
        if os.path.isdir(keys):
            input('占用{0}字节!'.format(
                py.PathSize.getpathSize(keys)
                ))
        else:
            input("错误! 不是一个正确的目录.")
            continue



if __name__ == '__main__':
    main()
